package com.tao.mapper;

import com.github.pagehelper.Page;
import com.tao.annotation.AutoFill;
import com.tao.enumeration.OperationType;
import com.tao.pojo.dto.PageSelectSetmealDto;
import com.tao.pojo.dto.SetmealDto;
import com.tao.pojo.entity.Product;
import com.tao.pojo.entity.Setmeal;
import com.tao.pojo.vo.SetmealByIdVo;
import com.tao.pojo.vo.SetmealVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SetmealMapper {

    @AutoFill(value = OperationType.INSERT)
    void addSetmealMapper(Setmeal setmeal);

    SetmealByIdVo getById(Integer id);

    void deleteSetmeal(List<Integer> ids);

    @AutoFill(value = OperationType.UPDATE)
    void updateSetmeal(Setmeal setmeal);

    @Update("update setmeal set status=#{status} where id=#{id}")
    void updateStatus(Integer id , Integer status);

    Page<SetmealVo> pageSelect(PageSelectSetmealDto pageSelectSetmealDto);

    @Select("select * from setmeal where category_id=#{categoryId}")
    List<Setmeal> selectByCategoryId(Integer categoryId);

    List<Product> selectSetmealProduct(Integer id);

    Integer countByStatus(Integer status);
}
